package com.shengchao.examstar.rpc.question.enums;


import lombok.Getter;

public enum QuestionTypeEnum {
    SINGLE_CHOICE_QUESTIONS(1, "单选题", "objective"),
    MULTIPLE_CHOICE_QUESTIONS(2, "多选题", "objective"),
    TRUE_OR_FALSE_QUESTIONS(3, "判断题", "objective"),
    //填空
    FILL_IN_THE_BLANK_QUESTIONS(4, "填空题", "objective"),
    //简答题
    SHORT_ANSWER_QUESTIONS(5, "简答题", "Subjective"),
    //材料题
    MATERIAL_QUESTIONS(6, "材料题", "material"),
    //连线
    LINK_QUESTIONS(7, "连线题", "objective");

    @Getter
    private final Integer code;
    @Getter
    private final String name;
    @Getter
    private final String type;

    QuestionTypeEnum(Integer code, String name, String type) {
        this.code = code;
        this.name = name;
        this.type = type;
    }

    //通过code获取枚举
    public static QuestionTypeEnum getEnumByCode(Integer code) {
        for (QuestionTypeEnum questionType : QuestionTypeEnum.values()) {
            if (questionType.getCode().equals(code)) {
                return questionType;
            }
        }
        return null;
    }

}
